using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing.Design;
using System.Text;

using Microsoft.Practices.EnterpriseLibrary.Configuration.Design;
using Microsoft.Practices.EnterpriseLibrary.Configuration.Design.Validation;
using Microsoft.Practices.EnterpriseLibrary.Validation.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Validation.Configuration.Design.ValidatorNodes;

using EntLibContrib.Validation.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;

namespace EntLibContrib.Validation.Design.Nodes
{
    /// <summary>
    /// Respresents the designtime configuration node for an <see cref="EnumDefinedValidatorData"/>.
    /// </summary>
    public class EnumDefinedValidatorNode : ValueValidatorNode
    {
        /// <summary>
        /// Creates an instance of <see cref="EnumDefinedValidatorNode"/> based on default values.
        /// </summary>
        public EnumDefinedValidatorNode()
            : this(new EnumDefinedValidatorData(Resources.EnumDefinedValidatorNodeName))
        {
        }

        /// <summary>
        /// Creates an instance of <see cref="EnumDefinedValidatorNode"/> based on runtime configuration data.
        /// </summary>
        /// <param name="validatorData">The corresponding runtime configuration data.</param>
        public EnumDefinedValidatorNode(EnumDefinedValidatorData validatorData)
            : base(validatorData)
        {
        }

        /// <summary>
        /// Returns the runtime configuration data that is represented by this node.
        /// </summary>
        /// <returns>An instance of <see cref="EnumDefinedValidatorData"/> that can be persisted to a configuration file.</returns>
        public override ValidatorData CreateValidatorData()
        {
            EnumDefinedValidatorData validatorData = new EnumDefinedValidatorData(Name);
            SetValidatorBaseProperties(validatorData);
            SetValueValidatorBaseProperties(validatorData);

            return validatorData;
        }
    }
}
